import java.util.Arrays;
import java.util.Scanner;

public class Test {
    /*public static int[] fib(int n){
       if(n<=0){
           return null;
       }
       int[] array = new int[n];
       array[0] = array[1] = 1;
       for (int i = 2; i < n; i++) {
            array[i] = array[i-1] + array[i-2];
       }
       return array;
    }

    public static void main(String[] args) {
        //求斐波那契数列
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] ret = new int[n];
        ret = fib(n);
        for (int x : ret) {
            System.out.print(x+" ");
        }
    }*/


   /* public static void main(String[] args) {
        int[] array = new int[]{1,2,3,4};
        func1(array);
        for (int x: array) {
            System.out.print(x+" ");
        }
        System.out.println("\n");
        func2(array);
        for (int x: array) {
            System.out.print(x+" ");
        }
    }
    public static void func1(int[] array){
        array[0] = 90;
    }
    public static void func2(int[] array){
        array = new int[]{1,2,3,4,5};
    }*/


    /*public static void main(String[] args) {
        int[] ret = new int[4];
        ret = func(ret);
        for (int x:
             ret) {
            System.out.print(x+" ");
        }
    }
    public static int[] func(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = i+1;
        }
        return array;
    }*/


   /* public static void main(String[] args) {
        int[] array = new int[]{1,2,3,4};
        //把数组array的内容转换为字符串，以字符串的方式返回
        String ret = Arrays.toString(array);
        System.out.println(ret);
    }*/


    /*public static void main(String[] args) {
        int[] array = new int[]{4,3,2,1};
        String ret = Arrays.toString(array);
        System.out.println("排序前："+ret);
        Arrays.sort(array);
        ret = Arrays.toString(array);
        System.out.println("排序后："+ret);
    }*/


    /*public static void main(String[] args) {
        int[] array = new int[]{4,3,2,1};
        arraysMySort(array);//用C语言里我们学过的冒泡排序的思想来实现
        //int[] array = {};
        String ret = arraysMyToString(array);
        System.out.println(ret);
    }
    public static void arraysMySort(int[] array){
        if(array == null){
            return ;
        }
        //趟数
        for (int i = 0; i < array.length-1; i++) {
            //每一趟要比较的内容
            int flag = 1;//假设已经有序
            for (int j = 0; j < array.length-1-i; j++) {
                //开始比较（根据我们自己的需要——>升序）
                if(array[j] > array[j+1]){
                    flag = 0;//如果交换了，就说明还不是有序的
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                }
            }
            //如果一次也没有交换，就说明已经有序了，就不需要比较了
            if(flag == 1){
                break;
            }
        }
    }
    public static String arraysMyToString(int[] array){
        if(array == null){
            return "null";
        }
        if(array.length == 0){
            return "[]";
        }
        //上面两个都是根据标准的Arrays.toString()来模拟的
        String ret = "[";//最左边
        for (int i = 0; i < array.length; i++) {
            ret += array[i];
            //最后一个数据后面不需要加逗号
            if(i != array.length-1){
                ret += ",";
            }
        }
        ret += "]";//最右边
        return ret;
    }*/


    /*public static void main(String[] args) {
        //数组逆序
        int[] array = new int[]{1,2,3,4,5,6,7,8,9,10};
        reverseArray(array);
        String ret = Arrays.toString(array);
        System.out.println(ret);
    }
    public static void reverseArray(int[] array){
        int i = 0;
        int j = array.length-1;
        //写成i<=也是可以的，但是没必要。当i和j指向同一个数组下标时，再去交换也不会产生任何变化
        while(i < j){
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
            i++;
            j--;
        }
    }
*/
}
